package com.ygqh.baby.model;

import com.foxinmy.weixin4j.util.StringUtil;
import com.ygqh.baby.ao.UserType;
import com.ygqh.baby.utils.DateConvertUtils;
import com.ygqh.baby.utils.PhoneUtils;
import com.ygqh.baby.utils.YgStringUtils;

import java.io.Serializable;
import java.util.Date;

public class YgUserModel implements Serializable {
	private static final long serialVersionUID = 1476374453186048731L;

	private Long id;

	private String userName;

	private String nickName;

	private UserType userType;

	private Integer gender;

	private String telPhone;

	private Integer babyGender;

	private Date babyBirthday;

	private String bBirthday;

	private String headImageUrl;

	private String openId;

	private String uuid;

	private String sourceCode;

	private String fromCode;

	private String groupTag;

	private Integer level;

	private Date memberEndTime;
	private Date memberStartTime;
	private Date agentCheckTime;

	public YgUserModel() {
		super();
	}

	public String getGroupTag() {
		return groupTag;
	}

	public void setGroupTag(String groupTag) {
		this.groupTag = groupTag;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public String getTelPhone() {
		return telPhone;
	}

	public void setTelPhone(String telPhone) {
		this.telPhone = telPhone;
	}

	public Integer getBabyGender() {
		return babyGender;
	}

	public void setBabyGender(Integer babyGender) {
		this.babyGender = babyGender;
	}

	public Date getBabyBirthday() {
		return babyBirthday;
	}

	public void setBabyBirthday(Date babyBirthday) {
		this.babyBirthday = babyBirthday;
	}

	public String getHeadImageUrl() {
		return headImageUrl;
	}

	public void setHeadImageUrl(String headImageUrl) {
		this.headImageUrl = headImageUrl;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getSourceCode() {
		return sourceCode;
	}

	public void setSourceCode(String sourceCode) {
		this.sourceCode = sourceCode;
	}

	public String getFromCode() {
		return fromCode;
	}

	public void setFromCode(String fromCode) {
		this.fromCode = fromCode;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getbBirthday() {
		return bBirthday;
	}

	public void setbBirthday(String bBirthday) {
		this.bBirthday = bBirthday;
	}

	public UserType getUserType() {
		return userType;
	}

	public void setUserType(UserType userType) {
		this.userType = userType;
	}

	public Date getMemberEndTime() {
		return memberEndTime;
	}

	public Boolean isMembersValid() {
		if (memberEndTime == null) {
			return false;
		} else if (DateConvertUtils.getDateStart(new Date()).after(memberEndTime)) {
			return false;
		}
		return true;
	}

	public void setMemberEndTime(Date memberEndTime) {
		this.memberEndTime = memberEndTime;
	}

	public Date getMemberStartTime() {
		return memberStartTime;
	}

	public void setMemberStartTime(Date memberStartTime) {
		this.memberStartTime = memberStartTime;
	}

	public Date getAgentCheckTime() {
		return agentCheckTime;
	}

	public void setAgentCheckTime(Date agentCheckTime) {
		this.agentCheckTime = agentCheckTime;
	}
	public String getSourceCodeEncrypt() {
		if(StringUtil.isNotBlank(sourceCode) && YgStringUtils.isNum(sourceCode)){
			return PhoneUtils.encryptPhone(sourceCode);
		}
		return sourceCode;
	}


}